#coding=utf-8
from django.db import models

# Create your models here.
class Chart(models.Model):
    distribution_frame = models.CharField('配线架', max_length=10)#配线架
    seat_port = models.CharField('座位端口', max_length=10)#座位端口
    switches_port = models.CharField('交换机端口', max_length=10)#交换机端口

    switches_model = models.CharField('交换机型号', choices=(('3300', '3COM 3300'), ('4400', '3COM 4400')), max_length=10)
    person = models.CharField('对应人', max_length=50)#对应人
    ip = models.IPAddressField('ip地址', max_length=20)#ip地址
    date = models.DateTimeField(blank=True, null=True)#
    remark = models.TextField('备注', blank=True)#备注   
    
from pydemo.control.models import Chart
from django.contrib import admin    

class ChartAdmin(admin.ModelAdmin):
    list_display = ('distribution_frame', 'seat_port', 'switches_port', 'switches_model', 'person', 'ip', 'remark',)
    list_filter = ('switches_model', 'switches_port', 'person',)
    search_fields = ('distribution_frame', 'seat_port', 'switches_port', 'switches_model', 'person', 'ip', 'remark',)
    fieldsets = [
        ('必填项', {'fields':['distribution_frame', 'seat_port', 'switches_port', 'switches_model', 'person', 'ip']}),
        ('可选项', {'fields':['date', 'remark'], 'classes':['collapse']}),
    ]
    
admin.site.register(Chart, ChartAdmin) 